package com.engr.springbooteasypoi.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadExecutors {

    public static void main(String[] args) {
        ExecutorService pool = Executors.newCachedThreadPool();
        //ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor();
        Thread thread1 = new ThreadExecute();
        Thread thread2 = new ThreadExecute();
        Thread thread3 = new ThreadExecute();
        Thread thread4 = new ThreadExecute();
        Thread thread5 = new ThreadExecute();
        pool.execute(thread1);
        pool.execute(thread2);
        pool.execute(thread3);
        pool.execute(thread4);
        pool.execute(thread5);
        pool.shutdown();
    }
}

class ThreadExecute extends Thread {
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + " is already execute");
    }
}
